<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@ page import="java.util.*"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<html>
<head>
<title>_托盘管理</title>
</head>

<body>
	<section class="content">
		<c:if test="${not empty message}">
			<div id="message" class="alert alert-success">
				<button data-dismiss="alert" class="close">×</button>${message}</div>
		</c:if>
		<div class="row">
			<div class="col-md-12">
				<div class="box box-solid box-primary">
					<div class="box-header">
						<i class="fa fa-search"></i>
						<h3 class="box-title">搜索栏</h3>
						<div class="box-tools pull-right">
							<button class="btn btn-primary btn-sm" data-widget="collapse">
								<i class="fa fa-minus"></i>
							</button>
						</div>
					</div>
					<div class="box-body">

						<form class="form-search" action="${ctx}/v2_pallet/page"
							id="queryForm" method="post">
							<div class="form-group row">
								<div class="col-sm-3">
									<div class="input-textgroup  col-sm-12">
										<label class="input-group-text">LPN编码：</label> <input
											class="form-control" id="_lpnNo" name="_lpnNo"
											value="${_lpnNo}">
									</div>
								</div>
								<div class="col-sm-3">
									<div class="input-textgroup  col-sm-12">
										<span class="input-group-text"> 托盘状态: </span> <select
											name="_status" id="_status" class="form-control">
											<option value=""></option>
											<option value="1"
												<c:if test="${_status eq '1'}">selected=selected</c:if>>空闲</option>
											<option value="2"
												<c:if test="${_status eq '2'}">selected=selected</c:if>>使用中</option>
											<option value="3"
												<c:if test="${_status eq '3'}">selected=selected</c:if>>禁用</option>
										</select>
									</div>
								</div>
								<div class="col-sm-3">
									<div class="input-textgroup  col-sm-12">
										<span class="input-group-text"> 仓库: </span> <select
											name="_warehouseCode" id="_warehouseCode"
											value="${_warehouseCode}" style="width: 157px;"
											class="form-control">
											<option value=""></option>
											<c:forEach items="${warehouseList}" var="wm">
												<option value="${wm.groupCode}"
													<c:if test="${_warehouseCode eq wm.groupCode}">selected=selected</c:if>>${wm.groupName}</option>
											</c:forEach>
										</select>
									</div>
								</div>
							</div>
							<div class="form-group row">
								<div class="col-sm-3">
									<div class="input-textgroup  col-sm-12">
										<label class="input-group-text">创建日期：</label> <input
											type="text" class="form-control" id="_startTime"
											name="_startTime" value="${_startTime }">
									</div>
								</div>

								<div class="col-sm-3">
									<div class="input-textgroup  col-sm-12">
										<label class="input-group-text">至：</label> <input type="text"
											class="form-control" id="_endTime" name="_endTime"
											value="${_endTime }">
									</div>
								</div>
								<button type="submit" class="btn btn-info">搜索</button>
							</div>
						</form>
						<div class="form-group row">
							<div class="col-sm-4">
								<div class="input-textgroup  col-sm-12">
									<a href="#selextPrinter" data-toggle="modal"
										class="btn btn-info" onclick="initPrinter();"
										id="btn_printCodeAll">批量打印条码</a> <a class="btn btn-info"
										id="btn-releaseAll">批量释放</a> <a class="btn btn-info"
										id="btn-offAll">批量禁用</a> <a class="btn btn-info"
										href="${ctx}/v2_pallet/v2_create">新增托盘</a>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<div class="box box-solid box-primary">
					<div class="box-header">
						<i class="fa fa-list"></i>
						<h3 class="box-title">查询结果</h3>
						<div class="box-tools pull-right">
							<button class="btn btn-primary btn-sm" data-widget="collapse">
								<i class="fa fa-minus"></i>
							</button>
						</div>
					</div>
					<div class="box-body">
						<div class="form-group row">
							<div class="col-md-12">
								<input type="hidden" id="lpnNos" name="lpnNos">
								<table id="contentTable" name="orderTab"
									class="table table-striped table-bordered table-condensed">
									<thead>
										<tr>
											<th><input type="checkbox" name="myCheckedAll"
												id="myCheckedAll" /></th>
											<th>序号</th>
											<th>LPN编码</th>
											<th>托盘名称</th>
											<th>托盘编号</th>
											<th>仓库</th>
											<th>托盘状态</th>
											<th>使用详情</th>
										</tr>
										<c:if test="${not empty palletList}">
											<c:forEach items="${palletList}" var="pallet" varStatus="i">
												<tr>
													<td align="right"><input type="checkbox"
														name="myChecked" value="${pallet.lpnNo}"/> <input
														type="hidden" id="lpnNo_${pallet.lpnNo}" value="${pallet.lpnNo}"></td>
													<td>${i.count}</td>
													<td>${pallet.lpnNo}</td>
													<td>${pallet.name}</td>
													<td>${pallet.palletNum}</td>
													<td><c:forEach items="${warehouseList}" var="wm">
															<c:if test="${pallet.warehouseCode eq wm.groupCode}">${wm.groupName}</c:if>
														</c:forEach></td>
													<td id="status_${pallet.lpnNo}"><c:if
															test="${pallet.status eq 1}">空闲</c:if> <c:if
															test="${pallet.status eq 2}">使用中</c:if> <c:if
															test="${pallet.status eq 3}">禁用</c:if></td>
													<td id="operate_${pallet.lpnNo}"><a
														class="btn btn-primary"
														href="${ctx}/v2_pallet/page2/${pallet.lpnNo}">查看</a><a
														href="#selextPrinter" data-toggle="modal"
														class="btn btn-primary"  name="btn_printCode">打印条码</a><c:if
															test="${pallet.status eq 3}"><a class="btn btn-primary" name="btn-release"
																release="${pallet.lpnNo}">释放</a>
														</c:if><c:if test="${pallet.status eq 2}"><a class="btn btn-primary" name="btn-release"
																release="${pallet.lpnNo}">释放</a>
														</c:if><c:if test="${pallet.status eq 1}"><a class="btn btn-primary" name="btn-off"
																off="${pallet.lpnNo}">禁用</a>
														</c:if></td>
												</tr>
											</c:forEach>
										</c:if>
									</thead>
									<tbody>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<!-- 打印条码窗体2 -->
		<div class="modal  fade" tabindex="-1" role="dialog"
			aria-labelledby="myModalLabel" aria-hidden="true" id="selextPrinter">
			<div class="modal-dialog" style="width: 1000">
				<div class="modal-content">
					<div class="modal-header">
						<h3 id="printerNumber">打印条码</h3>
					</div>

					<div class="modal-body" style="margin-left: 100px;">
						<select id="printerBody" name="printerBody" style="width: 300px;"></select>
					</div>

					<div class="modal-footer">
						<a role="button" class="btn btn-primary" id="beginPrint" data-dismiss="modal">开始打印</a>
						<button class="btn btn-primary" data-dismiss="modal"
							aria-hidden="true">取消</button>
					</div>
				</div>
			</div>
		</div>
	</section>
	<script type="text/javascript" src="../static/v2/js/lpn/palletList.js"></script>
	<script type="text/javascript"
		src="../static/v2/js/plugins/datatables/1.10.7/jquery.dataTables.js"></script>
</body>
</html>
